package com.huishu.tcm.controller;

import cn.dev33.satoken.stp.StpUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.IService;
import com.huishu.tcm.entity.User;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class BaseController<Service extends IService> {

    @Autowired
    protected Service service;

    @Resource
    protected HttpServletRequest request;

    @Resource
    HttpServletResponse response;

    /**
     * 获取当前登录的用户
     * @return
     */
    public User getLoginUser(){
        return JSONObject.parseObject((String)StpUtil.getLoginId(),User.class);
    }
}
